package com.ssm.juc.theadpool.task;

import org.jetbrains.annotations.NotNull;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 线程工厂类
 */
public class TTheadFactory implements ThreadFactory {

    final AtomicInteger threadNumber = new AtomicInteger(1);

    @Override
    public Thread newThread(@NotNull Runnable r) {
        return new Thread(r, "order-task-thread[" + threadNumber.incrementAndGet() + "]-");
    }
}
